<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Package extends Module {

	public $version = 1.1;

	public function info()
	{
		return array(
			'name' => array(
				'nl' => 'Package',
				'en' => 'Package'
			),
			'description' => array(
				'nl' => 'Package Management',
				'en' => 'Package Management'
				),
			'frontend' => TRUE,
			'backend' => TRUE,
			'skip_xss'	=> TRUE,
			'menu'		=> 'Package',
			'shortcuts' => array(
				array(
			 	   'name' => 'uploking_package_create_title',
				    'uri' => 'admin/package/create',
				    'class' => 'add'
				),
			),
		);
	}

	public function install()
	{
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_user_packages')." (
						`id` INT NOT NULL AUTO_INCREMENT ,
				  		`user_id` INT NULL ,
				  		`package_id` INT NULL ,
				  		`buy_time` INT NULL ,
				  		`status` INT NULL,
			  			PRIMARY KEY (`id`)
					) ENGINE=InnoDB DEFAULT CHARSET=utf8
				");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_packages')." (
						`id` INT NOT NULL AUTO_INCREMENT ,
				  		`name` VARCHAR(255) NULL ,
				  		`price` INT NULL ,
				  		`month` INT NULL ,
				  		`description` VARCHAR(555) NULL ,
				  		`created_time` INT NULL ,
			  			PRIMARY KEY (`id`)
					) ENGINE=InnoDB DEFAULT CHARSET=utf8
				");
	}

	public function uninstall()
	{
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */